package activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.administrator.ci_edit.R;

/**
 * Created by Administrator on 2017/7/15.
 */

public class XiaobaiAndDashen extends AppCompatActivity {

    private Button btn_xiaobai;
    private Button btn_dashen;

    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dashen_xiaobai);

        btn_xiaobai = (Button) findViewById(R.id.xiaobai);
        btn_dashen = (Button) findViewById(R.id.dashen);

        btn_xiaobai.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialog.Builder builder = new AlertDialog.Builder(XiaobaiAndDashen.this);
                builder.setIcon(R.mipmap.ic_launcher);
                builder.setTitle("对不起");
                builder.setMessage("这个APP不适合你");
                builder.setPositiveButton("退出", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        Toast.makeText(XiaobaiAndDashen.this, "拜拜", Toast.LENGTH_LONG).show();
                        System.exit(1);
                    }
                });
                builder.setNegativeButton("VIP", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        // 打赏功能
                        Intent intent = new Intent(XiaobaiAndDashen.this, DaShangActivity.class);

                        startActivity(intent);
                    }
                });
                AlertDialog b = builder.create();
                b.show();
                //在这里输入要跳转的界面
//                Toast.makeText(getApplicationContext(), "这个app不适合你",
//                        Toast.LENGTH_SHORT).show();
//               System.exit(0);
            }
        });

        btn_dashen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //在这里输入要跳转的界面
                Intent intent = new Intent(XiaobaiAndDashen.this, MainActivity.class);

                startActivity(intent);
            }
        });
    }
}
